package com.meituan.catering.management.shop.api.thrift.service;

import com.meituan.catering.management.common.model.api.thrift.UserContextThriftRequest;
import com.meituan.catering.management.common.model.biz.UserContextBO;
import com.meituan.catering.management.shop.api.thrift.model.response.ShopDetailThriftResponse;
import com.meituan.catering.management.shop.biz.model.ShopBO;
import com.meituan.catering.management.shop.biz.model.converter.ShopThriftVOConverter;
import com.meituan.catering.management.shop.biz.service.ShopBizService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@Service
public class ShopThriftServiceImpl implements ShopThriftService {
    /**
     * 引入查询服务
     */
    @Resource
    ShopBizService shopBizService;

    @Override
    public ShopDetailThriftResponse findByBusinessNo(
            UserContextThriftRequest userContext, String businessNo) {
        /*
         * 构建UserContext
         */
        UserContextBO userContextBO = new UserContextBO();
        userContextBO.setTenantId(userContext.getTenantId());
        userContextBO.setUserId(userContext.getUserId());
        ShopBO shopBO = shopBizService.findByBusinessNo(userContextBO, businessNo);

        ShopDetailThriftResponse shopDetailThriftResponse = ShopThriftVOConverter.fromBO(shopBO);
        return shopDetailThriftResponse;
    }

    @Override
    public List<ShopDetailThriftResponse> findByBusinessNoList(UserContextThriftRequest userContext, Set<String> businessNoList) {
        return null;
    }
}
